//
//  CommentTableViewCell.m
//  GameBaby
//
//  Created by keyZhang on 14-1-13.
//  Copyright (c) 2014年 keyZhang. All rights reserved.
//

#import "CommentTableViewCell.h"

@implementation CommentTableViewCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)layoutSubviews
{
    UIBezierPath* path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(25, 25) radius:25 startAngle:0 endAngle:2*M_PI clockwise:YES];
    CAShapeLayer* shape = [CAShapeLayer layer];
    shape.path = path.CGPath;
    self.headImg.layer.mask = shape;
    if (![self.model.username isEqualToString:@""]) {
        self.nameLabel.text = self.model.username;
    }else
    {
        self.nameLabel.text = self.model.uid;
    }
    
    NSString *uptimeData = self.model.uptime;
    self.timeLabel.text = [uptimeData substringFromIndex:5];
    self.commentLabel.text = self.model.commentmsg;
    
    if (![self.model.avatar isEqualToString:@""]) {
        [self.headImg setImageWithURL:[NSURL URLWithString:self.model.avatar]];
    }else
    {
        self.headImg.image = [UIImage imageNamed:@"avatarsmall.png"];
    }
}

@end
